package com.suppor.rpc.proto.protocol;

public enum MsgType {
    REQUEST(1),
    RESPONSE(2),
    HEARTBEAT(3);

    private Integer type;

    MsgType(Integer type) {
        this.type = type;
    }

    public Integer getType() {
        return type;
    }

    public static MsgType findType(byte msgType) {
        for (MsgType value : MsgType.values()) {
            if (value.getType() == msgType) {
                return value;
            }
        }
        throw new RuntimeException("Not Support Type: " + msgType);
    }
}
